package com.ktg.mes.wm.domain;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
import java.math.BigDecimal;

import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ktg.common.annotation.Excel;
import com.ktg.common.core.domain.BaseEntity;


/**
 * 产品出库记录对象 wm_stock_will_out
 *
 * @author byteco
 * @date 2022-12-15
 */

@Data
@Accessors(chain = true)
@TableName("wm_stock_will_out")
public class WmStockWillOut extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 记录ID */
    @TableId(value = "record_id", type = IdType.AUTO)
    private Long recordId;


    /** 关联表 */
    @Excel(name = "使用物料的表名")
    private String linkType;


    /** 关联ID */
    @Excel(name = "使用物料的表ID")
    private String linkId;


    /** 库存表 */
    @Excel(name = "库存表")
    private String stockType;


    /** 库存ID */
    @Excel(name = "库存ID")
    private String stockId;


    /** 预出库数量 */
    @Excel(name = "预出库数量")
    private BigDecimal quantity;


    /**
     * 客户需求产品Id
     */
    @TableField(exist = false)
    private String needItemId;

    /**
     * 预出库产品ID
     */
    @TableField(exist = false)
    private String willOutItemId;


    /**
     * 设置库存记录
     * @param c
     * @param stockId
     */
    public void stockTableClass(Class<?> c,Long stockId){
        stockTableClass(c,String.valueOf(stockId));
    }

    /**
     * 设置为了谁预出
     * @param c
     * @param linkId
     */
    public void linkTableClass(Class<?> c,Long linkId){
        linkTableClass(c,String.valueOf(linkId));
    }


    /**
     * 设置库存记录
     * @param c
     * @param stockId
     */
    public void stockTableClass(Class<?> c,String stockId){
       String tableName =  c.getAnnotation(TableName.class).value();
       this.stockType = tableName;
       this.stockId = stockId;
    }

    /**
     * 设置为了谁预出
     * @param c
     * @param linkId
     */
    public void linkTableClass(Class<?> c,String linkId){
        String tableName =  c.getAnnotation(TableName.class).value();
        this.linkType = tableName;
        this.linkId = linkId;
    }

    public void setQuantity(BigDecimal quantity){
        this.quantity = quantity;
    }
    public void setQuantity(float quantity) {
        this.quantity = new BigDecimal(quantity);
    }

}
